//
//  ZZTopicCommentEntity.m
//  QQplayground
//
//  Created by zhangxy on 2018/6/11.
//  Copyright © 2018年 zhang. All rights reserved.
//

#import "ZZTopicCommentEntity.h"

@implementation ZZTopicCommentEntity



- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self = [ZZTopicCommentEntity yy_modelWithDictionary:dictionary];
        
        _user_info = [[User alloc] initWithDictionary:dictionary[@"user_info"]];
        
        NSMutableArray *arr = dictionary[@"thread_list"];
        _thread_list = [[NSMutableArray alloc] init];
        for (NSDictionary *item in arr) {
            [_thread_list addObject:[[ZZTopicCommentEntity alloc] initWithDictionary:item]];
        }
        
        
        NSMutableArray *list = dictionary[@"list"];
        if(list && list.count > 0 ){
            _thread_list = [[NSMutableArray alloc] init];
            for (NSDictionary *item in list) {
                [_thread_list addObject:[[ZZTopicCommentEntity alloc] initWithDictionary:item]];
            }
        }
        
        _message_image = [[NSMutableArray alloc] init];
        NSArray *imgs = dictionary[@"message_image"];
        if(imgs){
            for (NSDictionary *item in imgs) {
                [_message_image addObject:[[ImageEntity alloc] initWithDictionary:item]];
            }
        }
        NSArray *imgs1 = dictionary[@"image"];
        if(imgs1){
            for (NSDictionary *item in imgs1) {
                [_message_image addObject:[[ImageEntity alloc] initWithDictionary:item]];
            }
        }
        
        
        
        if(convertToString(dictionary[@"post_id"]).length > 0){
            _comment_id = convertToString(dictionary[@"post_id"]);
        }
        
    }
    return self;
}


+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper
{
    return @{
             @"comment_id" : @"id",
//             @"user_id" : @"user_id",
//             @"user_name":@"user_name",
//             @"user_avatar":@"user_avatar",
             @"message":@"message",
             @"add_time":@"add_time",
             @"page":@"page",
             @"page_size":@"page_size",
             @"count":@"count"
             };
}

@end
